<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/struts-tags" prefix="s"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title>后台管理</title>


	</head>
	<body>
		<div class="admin">
			<div class="panel admin-panel">
				<div class="panel-head">
					<form method="post" action="product!search1.action">
						<div class="line-middle">
							<div class="x3">

							</div>
							<div class="x5 ">
								<input name="key0" type="text" class="input radius-rounded"
									placeholder="请输入搜索关键字" />
							</div>
							<div class="x4">
								<button type="submit" class="button bg-blue">
									搜索
								</button>
							</div>
						</div>
					</form>
				</div>
				<form id="form" method="post" action="product!delete.action">
					<input type="text" name="page" value="${page}" style="display: none;">
					<div class="padding border-bottom">
						<input type="button" id="selectall"
							class="button button-small checkall" checkfor="id" value="全选" />
						<!-- 
						<a href="classify!productclassify.com.kecheng.action"><input type="button"
								class="button button-small border-green" value="添加商品" />
						</a>
						 -->
						<input type="submit" onclick="return submit();"
							class="button button-small border-yellow" value="批量删除" />
					</div>

					<table class="table table-hover">
						<tr>
							<th width="100">
								选择
							</th>
							<th width="200">
								编码
							</th>
							<th width="200">
								商品主图
							</th>
							<th width="200">
								商品标题
							</th>
							<th width="200">
								商品类型
							</th>
							<th width="100">
								价格
							</th>
							<th width="200">
								操作
							</th>
						</tr>

						<s:iterator value="products">
							<tr>
								<td>
									<input type="checkbox" class="choose" name="id"
										value="<s:property value="id"/>" />
								</td>
								<td>
									<s:property value="bianma" />
								</td>
								<td>
									<a  onclick="return false;"
										href="<%=request.getContextPath()%>/w/product!d.action?id1=<s:property value="id"/>"
										target="_blank"><img height="70" width="70"
											src="<%=request.getContextPath()%>/<s:property value="img"/>"
											target="_blank" /> </a>
								</td>
								<td>
									<a	onclick="return false;"
										href="<%=request.getContextPath()%>/w/product!d.action?id1=<s:property value="id"/>"
										target="_blank"><s:property value="title" /> </a>
								</td>
								<td>
									<s:property value="classify" />
								</td>
								<td>
									<s:property value="price" />
								</td>
								<td>
									<a class="button border-blue button-little"
										href="<%=request.getContextPath()%>/admin/product/product!update.action?id1=<s:property value="id"/>&page=${page}" />修改</a>
									<a class="button border-yellow button-little"
										href="product!delete.action?id=<s:property value="id"/>&page=${page}"
										onclick="{if(confirm('确认删除?')){return true;}return false;}">删除</a>
								</td>
							</tr>
						</s:iterator>
					</table>
				</form>
				<div class="panel-foot text-center">
					<ul class="pagination">
						<li>
							<s:if test="page==1">
								<a href="#" onclick="return false;">上一页</a>
							</s:if>
							<s:else>
								<a href="product!findall.action?page=${page-1}">上一页</a>
							</s:else>
						</li>
					</ul>
					<ul class="pagination pagination-group">
						<s:iterator begin="1" end="allpage" var="i">
							<s:if test="#i==page">
								<li class="active">
									<a href="product!findall.action?page=<s:property value="#i"/>"><s:property
											value="#i" /> </a>
								</li>
							</s:if>
							<s:else>
								<li>
									<a href="product!findall.action?page=<s:property value="#i"/>"><s:property
											value="#i" /> </a>
								</li>
							</s:else>
						</s:iterator>
					</ul>
					<ul class="pagination">
						<li>
							<s:if test="page==allpage">
								<a href="#" onclick="return false;">下一页</a>
							</s:if>
							<s:else>
								<a href="product!findall.action?page=${page+1}">下一页</a>
							</s:else>
						</li>
					</ul>
				</div>
			</div>
			<br />
		</div>
		<div class="hidden">
			<script src="http://s4.cnzz.com/stat.php?id=5952475&web_id=5952475"
				language="JavaScript"></script>
		</div>
		<script type="text/javascript">
			function submit() {
				var choose = document.getElementsByClassName("choose");
				return false;
				if ($('#selectall').is(':checked')) {
					choose[i].checked = true;
				} else {
					choose[i].checked = false;
				}
				//document.getElementBy("form").submit();
			}
		</script>
		<script type="text/javascript">
            $(function(){
                $("#product").addClass("active");
                $("#product").find("ul li").eq(0).addClass("active");
            })
		</script>

	</body>
</html>